/**
 * 
 */
package travibot.ui.gui.forms.providers.content;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

import travibot.engine.Session;


/**
 * @author tajzivit
 *
 */
public class CityListContentProvider implements ITreeContentProvider {

    public Object[] getChildren(Object parentElement) {

        if(parentElement instanceof Session)
            return ((Session)parentElement).getVillages().toArray();
        
        return new Object[]{};
    }

    public Object getParent(Object element) {

        // TODO Auto-generated method stub
        return null;
    }

    public boolean hasChildren(Object element) {

        if(!(element instanceof Session))
            return false;
        
        return (((Session)element).getVillages().size() > 0);
    }

    public Object[] getElements(Object inputElement) {

        return getChildren(inputElement);
    }

    public void dispose() {

        // TODO Auto-generated method stub
        
    }

    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {

        // TODO Auto-generated method stub
        
    }

    
}
